package users.tom.app;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.AbstractApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import users.tom.beans.Config;

public class AppTwo {

	/**
	 * @param args
	 */
	public static void main(String[] args) {

		final ApplicationContext context = new ClassPathXmlApplicationContext("users/tom/two.spring.xml");
		((AbstractApplicationContext) context).registerShutdownHook();
		
		
		final Config configProto = context.getBean("configProto", Config.class);
		final Config configSingl = context.getBean("configSingl", Config.class);
		
		configProto.setFrambosity(11);
		configSingl.setFrambosity(11);
		
		final Config configProtoAgain = context.getBean("configProto", Config.class);
		final Config configSinglAgain = context.getBean("configSingl", Config.class);
		
		System.out.println("ConfigProtoAgain (expect 7): " + configProtoAgain.getFrambosity());
		System.out.println("ConfigSinglAgain (expect 11):" + configSinglAgain.getFrambosity());
	}

}
